﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace encrypt
{
    internal class RSA : DoEncrypt
    {
        public override string GetEnctyptedText(string text)
        {
            CspParameters param = new CspParameters();
            param.KeyContainerName = "key_container";
            using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(param))
            {
                byte[] plaindata = Encoding.Default.GetBytes(text);
                byte[] encryptdata = rsa.Encrypt(plaindata,false);

                return Convert.ToBase64String(encryptdata);
            }
        }
    }
}
